The present disclosure relates generally to the testing and development of software code, and in particular to the testing of widgets or other such code modules having a structured or hierarchical format.
With the increasing use of an object-oriented paradigm in Web programming, and other such structured languages, approaches to testing and debugging features on a page, display, or interface for an application or code module have changed to address such structures. For example, a Web page might include a number of widgets that can be displayed at any given time. In this context, a widget is a chunk or portion of Hypertext Markup Language (HTML) code, for example, that is embedded into a Web page, and which can function independently of any other components or widgets on that Web page, similar to an Object. Widgets can be thought of as self-packaged Web applications, or self-contained code modules, and are often interactive. When a Web page is loaded, the code for that page also will be loaded. As is known in the art, the HTML, Extensible Markup Language (XML), or other such code for the page will be structured with a series of hierarchical tags and values that can be interpreted by an appropriate application such as a Web browser or User Interface (UI).
The code can be parsed into a Document Object Model (DOM) tree by the browser or another application. A DOM tree includes a hierarchy of nodes for a page, interface, or display, in which a parent node is generally considered as enveloping any child node in the tree. In an example of Web UI Test Automation, node types such as element nodes and text nodes are of particular concern. An element DOM node generally acts as a container of text value nodes (e.g., a parent of a text node, like tags FONT or SPAN), and can be considered as any non-textual component that decorates a web or application page (e.g., clickable links, images, buttons, etc.). Text value DOM nodes include any type of node with a text value, such as a text node (i.e., displayable strings on the website), attribute node (i.e., an attribute of an element DOM node, such as HREF or ID), etc. These nodes are descendants of element nodes and are usually found at the fringes of the hierarchy, and thus are obtained via traversing through their parent element nodes.
In order to ensure proper functionality of widgets or other code modules, such as may be included on a single page, test cases are typically generated and executed to validate various aspects of the code modules. While the functionality can be tested manually through user observation, it is desirable to automate the test cases such that functionality can be tested at any time, using a quick and easy process that can be executed frequently, such as after each incremental change to the code, with little overhead. Test automation can thus be run unattended and can simulate actions of a user.
Current approaches to test automation for such purposes are not ideal, however, as it requires careful designing of a test automation framework to create test automation scripts that are reusable, or that are flexible to be adapted to different testing situations. Oftentimes the test automation scripts have state information hard-coded haphazardly, or have code that is at least partially re-written, for each test case. For example, the user interface features available over the Web are becoming evermore complex, resulting in the number of corresponding test cases increasing exponentially. Further, technologies such as AJAX (Asynchronous JavaScript® and XML) are commonly used today for Web development, which provide for display updates in a Web environment without the need to unload the current page and load another page. Such an approach results in significant manipulation of the structure of the page, with structures such as element nodes and text nodes being updated upon an event or user action in place. Such techniques further increase the number of test automation scripts needed. The need for a good coverage of test cases not only takes a significant amount of time and effort to generate, but becomes difficult and time consuming to maintain.